package com.yaozheng.vocationaltraining.service.impl;

import java.util.HashMap;

import net.sf.json.JSONObject;

import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.EBean;

import com.yaozheng.vocationaltraining.iview.IBaseView;
import com.yaozheng.vocationaltraining.iview.ITokenBaseView;
import com.yaozheng.vocationaltraining.iview.IVideoCoursewareView;
import com.yaozheng.vocationaltraining.service.CoursewareDetailService;
import com.yaozheng.vocationaltraining.utils.Constants;
import com.yaozheng.vocationaltraining.utils.ErrorUtils;
import com.yaozheng.vocationaltraining.utils.http.okhttp.OkHttpClientManager;

/**
 * 课件详情
 * 
 * @author Administrator
 * 
 */
@EBean
public class CoursewareDetailServiceImpl implements
		CoursewareDetailService {
	IVideoCoursewareView iTokenBaseView;

	@Override
	public void init(IVideoCoursewareView iTokenBaseView) {
		this.iTokenBaseView = iTokenBaseView;
	}

	@Background
	@Override
	public void getCourse(int id) {
		try {
			OkHttpClientManager.getInstance().get(
					Constants.ROOTURL + "/course?id=" + id,
					iTokenBaseView.getToken(), iTokenBaseView);
		} catch (Exception e) {
			ErrorUtils.outErrorLog(e);
			if (iTokenBaseView.isResponseResult()) {
				iTokenBaseView
						.responseError(ErrorUtils.SERVER_CONNECTION_ERROR);
			}

		}
	}

}
